﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace MarketDataAnalyzer
{
    public class ProjectedPriceAnalysis
    {
        public DateTime NewsEventTimeEst { get; set; }

        public int NewsId { get; set; }

        public string Symbol { get; set; }

        public IEnumerable<PricePoint> PricePoints { get; set; }

        public decimal GetPriceAtRelativeTime(int minutesRelativeToNewsEvent)
        {
            var price = PricePoints
                .Where( pp => pp.Time >= NewsEventTimeEst.AddMinutes( minutesRelativeToNewsEvent ) )
                .Select( pp => pp.Price )
                .FirstOrDefault();
            return price;
        }
    }
}
